package com.cn.fw4j.jdbc.sources.impl;

import java.sql.Connection;

import java.sql.DriverManager;
import java.sql.SQLException;

import com.cn.fw4j.jdbc.sources.inter.IDataSource;

public class H2DbDataSoruce implements IDataSource{
	private static Connection connect = null;
	static{
		try {
			Class.forName("org.h2.Driver");
			connect = DriverManager.getConnection("jdbc:h2:tcp://localhost:9123/~/test","sa","");
		} catch (ClassNotFoundException | SQLException e) {
			e.printStackTrace();
		}
	}
	@Override
	public Connection getConnection() {
		return connect;
	}

	@Override
	public void close() {
		try {
			connect.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

	@Override
	public boolean update() {
		return false;
	}

}
